var hostUrl = "http://47.107.185.60:8081"

function getAjax(type, url, datas) {
	return new Promise((resolve, reject) => {
		datas.channel="3"
		axios({
				method: type,
				url: hostUrl + url,
				headers: {
					'Content-Type': 'application/x-www-form-urlencoded'
				},
				data: type=='post'?transformRequest(datas) : datas
			}).then(function(res) {
				resolve(res.data);
			})
			.catch(function(error) {
				reject(error);
			});
	});
}

function transformRequest(data) {
	let params = '';
	for(let index in data) {
		params += index + '=' + data[index] + '&';
	}
	return params;
}